<?php include HEADER; ?>
<script>
	$(document).ready(function(){
		$("#btnsearch").click(function(){
			keyword = $("#tsearch").val();
			if(keyword =='' ){
				alert('Không được để trống.');
				return false;
			}
			location.href = '<?php echo __URL_BASE ?>index.php?rt=admin_comment&keyword='+keyword;
		});
		$('#tsearch').keyup(function(e){
			if(e.keyCode == 13)
			{
				$(this).trigger("enterKey");
				keyword = $("#tsearch").val();
				if(keyword =='' ){
					alert('Không được để trống.');
					return false;
				}
				location.href = '<?php echo __URL_BASE ?>index.php?rt=admin_comment&keyword='+keyword;
				
			}
		});
		$("#btnclear").click(function(){
			location.href = '<?php echo __URL_BASE ?>index.php?rt=admin_comment';
		});
	});
</script>
<table id="search" style="margin-bottom:20px;">
	<tr>
		<td>
			<input id="tsearch" type="text" class="text" placeholder="Tìm kiếm..." value="<?php if(isset($_REQUEST['keyword'])) echo $_REQUEST['keyword']  ?>" style="width:400px;" />
			<span style="position: relative;top:-2px;">
				<button id="btnsearch" type="button" class="btn btn-default">
					<img src="<?php echo __URL_BASE ?>img/search.png" width="15px" />
				</button>
				<button id="btnclear" type="button" class="btn btn-default" style="margin-left: -8px;border-radius: 0 4px 4px 0;">
					<img src="<?php echo __URL_BASE ?>img/x.png" width="15px" />
				</button>
			</span>
		</td>
</table>
<table class="TableView" cellspacing="1">
<tr class="trHeader">
    <!--<td><input type="checkbox" id="chkSelectAll" onclick="checkAll(this)" /></td>-->
    <td width="300px">Nội dung</td>
    <td >Người gửi</td>
	<td>Bình luận của Tivi</td>
	<td>Thời gian</td>

    <td width="100px">Trạng thái</td>
    <td width="60px"></td>
    
</tr>
<?php
    $i = 0;
	if($lstComment) :
		foreach($lstComment as $item){
			if($i%2==0){
	?>		
				<tr class="trOdd">
	
				
	<?php	
			}
			else{
	?>
				<tr class="trEven">
	<?php		
			}
	?>

	<td style="padding:0 3px;"><?php echo mb_substr($item->noidung,0,100,'utf-8')?>...</td>
	<td style="padding:0 3px;"><?php echo $item->tendangnhap ?></td>
	<td style="padding:0 3px;"><?php $tivi = new tivi(); echo $tivi->getTiviById($item->tivi_id)->TenTivi ?></td>
	<td style="padding:0 3px;"><?php echo date('d-m-Y G:i:s',strtotime($item->thoigian))?></td>
	<td style="text-align:center"><?php if($item->trangthai == "1"){ echo "Hiện";} else{ echo "Ẩn";} ?></td>
	<td style="text-align:center"><a href="<?php echo __URL_BASE.'index.php?rt=admin_comment/edit&comment_id='.$item->id ?>"><img src="<?php echo __URL_BASE ?>images/edit.png" style="cursor:pointer;" class="edit" /></a>
	<a href="<?php echo __URL_BASE.'index.php?rt=admin_comment/delete&comment_id='.$item->id ?>" onclick="return confirm(' Bạn chắc chắn muốn xóa?');"><img src="<?php echo __URL_BASE ?>images/delete.png" /></a></td>
	
	</tr>	
	<?php
			$i++;
		}
	endif;
?>


</table>

<?php utility::getPagination_admin($pages); ?>
<?php include FOOTER; ?>

